from nodetypes.formats.html import BasicChain

from MML import Transform


class Transform(Transform):
    
    chain = BasicChain
    
    def process(self, context, source):
        self.setup(context)
        
        context.model = context.nodeType.retrieveModel(context)
        
        # change these values to root values
        defaults = context.defaults
        context.resourceUri = context.uriMapper.apply(defaults.root_uri)
        context.sourceId = defaults.root_id
        
        doc, imt = self.newDocument().createDocument(context, source)
        
        return doc, imt, self.chain or context.chain